void BotNewGame();

static int writer(char *data, size_t size, size_t nmemb,std::string *buffer)
{
    int result = 0;
    if (buffer != NULL)
    {
        buffer->append(data, size * nmemb);
        result = size * nmemb;
    }
    return result;
}

int finditem;
int train;
int solo;

extern int BotGetInventaryInfo(int slot_y, int slot_x);
extern IplImage *IdentifyImageEmptySlots;
extern IplImage *IdentifyImageItemsToStash;
extern void randomfollow();
extern int DetectAct4();
extern void GetImageHash();
extern void BotDropItems();
extern int dropitems;
extern int loglevel;
extern ofstream logfile;
extern void logprint(std::string text, int ignore);
extern CURL *curl;
extern char currentPath[_MAX_PATH];
extern char *TestKey;
extern LPSTR GetValueFromINI(LPSTR FileName, LPSTR Section, LPSTR Key);
extern char *mymd5;
extern int noauth;
extern int noauthupdate;
extern BITMAPCAPTURE globalscreengrab;
extern BOOL CaptureScreen(BITMAPCAPTURE *bmpCapture);
extern int GetLocationHash(BITMAPCAPTURE *grab);
extern void BotGetScreenPng();
extern HBITMAP membit;
extern HDC scrdc, memdc;
extern IplImage * GetIplImage(HBITMAP HBM);
extern vector<string> splitString(string input, string delimiter);
extern void SetCursorPosition(int x,int y);
extern int BotGetConfig(char* param);
extern void BotUpdateSession();
extern void BotSleep(int type, int perem1, int perem2, int perem3, int perem4, int perem5, int perem6, int perem7, int perem8, int perem9, int perem10, int perem11, int sleeptime);
extern int itemvalue_blue;
extern int itemvalue_yellow;
extern int itemvalue_green;
extern int itemvalue_legendary;
extern int itemvalue_gems;
extern int itemvalue_rings;
extern int itemvalue_amulets;
extern int itemvalue_arhonts;
extern int itemvalue_recipes;
extern int itemvalue_potions;
extern int itemvalue_books;
extern int identify;
extern int BotGetConfig(char* param);
extern int FullSlot;
extern int SleepTime;
extern int MainAttack;
extern int attackskillduration;
extern int mainattackcooldown;
extern int secondaryattackcooldown;
extern int secondaryattackpause;
extern int secondaryduration;
extern int attackbutton1;
extern int attackbutton2;
extern int attackbutton3;
extern int attackbutton4;
extern int healbutton1;
extern int healbutton2;
extern int healbutton3;
extern int healbutton4;
extern int buffbutton;
extern int movebutton;
extern int key_showitems;
extern int buffduration;
extern int BuffCount;
extern int leavehp;
extern int dangerleavehp;
extern int needrepair;
extern int skillhp;
extern int potionhp;
extern int maxdeathcount;
extern int salvage;
extern int repair;
extern int BotGetStatus(BITMAPCAPTURE *grab);
extern int location;
extern int BotGetLocation();
extern int BotDeathCount;
extern int Event;
extern int FindItemColor(BITMAPCAPTURE *grab);
extern int rx;
extern int ry;
extern void BotGoToBase();
extern int StartLevel;
extern int FindFriendDie(BITMAPCAPTURE *grab);
extern int FindDieColor(BITMAPCAPTURE *grab);
extern int healdanger;
extern int botattackcount;
extern int followcount;
extern int noputitemteleport;
extern int FindAttackColor(BITMAPCAPTURE *grab);
extern void BotAttack();
extern void BotHeal();
extern int FindFollowColor(BITMAPCAPTURE *grab);
extern void BotFollowPlayer(int startx, int starty);
extern int FindPlayersBeside(BITMAPCAPTURE *grab);
int finditemx;
int finditemy;
int downclicks;
int ycoordinate;
int followmaxtime = 200;
int endeventrestart;
int endeventcount = 0;
int attackloop = 0;
int GameSubMode;
int finditemcount = 0;
int EventEnd = 0;
int AuthEvent = 0;
int RestartEventCount = 0;
int EventCount = 0;
int NoTeleportCount = 0;
int EventNotStart = 0;
int red = 0;
int hpred = 0;
int GoToStart = 0;
int green = 0;
int hpgreen = 0;
int blue = 0;
int hpblue = 0;
int kickgame = 0;
int FlagStartX;
int FlagStartY;
string dangeLocationName;
int EventEndCount = 0;
int restartgame = 0;
int firststart = 1;


extern int startteleport;
extern int FindFlagColor(BITMAPCAPTURE *grab);
extern void BotFollowFlag();
extern int NoEventCount;
extern int teleportstepcount;
extern int BotGetBotInGame(BITMAPCAPTURE *grab);
extern int act4;
extern int LocationName;

extern int LOCATION_NEDRA_GORI_ARREAT;
extern int LOCATION_NIZHNIE_ETASHI_KREPOSTI_1;
extern int LOCATION_KAMENNIY_FORT;
extern int LOCATION_NIZHNIE_ETASHI_KREPOSTI_3;
extern int LOCATION_ARREATSKIY_KRATER_1;
extern int LOCATION_BASHNYA_OBRECHENNUH_1;
extern int LOCATION_ARREATSKIY_KRATER_2;
extern int LOCATION_BASHNYA_PROKLYATIH_1;
extern int LOCATION_MOST_KORSIKKA;
extern int LOCATION_POLYA_KROVAVOI_BOINY;
extern int LOCATION_MOST_RAKKISA;
extern int LOCATION_BASHNYA_OBRECHENNUH_2;
extern int LOCATION_SERDCE_OBRECHENNUH;
extern int LOCATION_BASHNYA_PROKLYATIH_2;
extern int LOCATION_SERDCE_PROKLYATIH_2;